package com.algorithm.base.sort;

public class BubbleSort {
    public static void sortArray(int a[]) {
        int n = a.length;
        boolean change = true;
        for (int i = 0; i < n - 1 && change; i++) {
            change = false;
            for (int j = 0; j < n - 1 - i; j++) {
                if (a[j] > a[j + 1]) {
                    int temp = a[j + 1];
                    a[j + 1] = a[j];
                    a[j] = temp;
                    change = true;
                }
            }
        }
    }
}
